#include <iostream>
#include <vector>

// 全局变量用于存储中间值
int xpmclzjkln;

// 找到矩阵中最大元素的位置
std::pair<int, int> findMaxValue(const std::vector<std::vector<int>>& matrix) {
    int maxVal = matrix[0][0];
    int maxRow = 0, maxCol = 0;
    for (size_t i = 0; i < matrix.size(); ++i) {
        for (size_t j = 0; j < matrix[0].size(); ++j) {
            if (matrix[i][j] > maxVal) {
                maxVal = matrix[i][j];
                maxRow = i;
                maxCol = j;
            }
        }
    }
    xpmclzjkln = maxVal;
    return {maxRow, maxCol};
}

// 执行轰炸操作
std::vector<std::vector<int>> bomb(std::vector<std::vector<int>> matrix, int k) {
    for (int i = 0; i < k; ++i) {
        if (matrix.empty() || matrix[0].empty()) {
            break;
        }
        auto [maxRow, maxCol] = findMaxValue(matrix);
        std::vector<std::vector<int>> newMatrix;
        for (size_t r = 0; r < matrix.size(); ++r) {
            if (r != static_cast<size_t>(maxRow)) {
                std::vector<int> newRow;
                for (size_t c = 0; c < matrix[0].size(); ++c) {
                    if (c != static_cast<size_t>(maxCol)) {
                        newRow.push_back(matrix[r][c]);
                    }
                }
                newMatrix.push_back(newRow);
            }
        }
        matrix = newMatrix;
    }
    return matrix;
}

int main() {
    int n, m, k;
    std::cin >> n >> m >> k;

    std::vector<std::vector<int>> matrix(n, std::vector<int>(m));
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            std::cin >> matrix[i][j];
        }
    }

    auto resultMatrix = bomb(matrix, k);

    for (size_t i = 0; i < resultMatrix.size(); ++i) {
        for (size_t j = 0; j < resultMatrix[0].size(); ++j) {
            if (j > 0) {
                std::cout << " ";
            }
            std::cout << resultMatrix[i][j];
        }
        std::cout << std::endl;
    }

    return 0;
}    